package com.youle.service;

import com.youle.enums.ExceptionEnum;
import com.youle.exception.YLException;
import com.youle.item.pojo.Specification;
import com.youle.mapper.SpecificationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * Created by
 *
 * @author touni
 * @date 2019/4/23
 * @time 15:49
 */
@Service
public class SpecificationService {

    @Autowired
    private SpecificationMapper specificationMapper;




    public ResponseEntity listSpecificationByCid(Long cid) {
        Specification specificationFormQuery = specificationMapper.selectByPrimaryKey(cid);
        if (StringUtils.isEmpty(specificationFormQuery)){ throw new YLException(ExceptionEnum.NOT_FOUND);}
        return ResponseEntity.ok(specificationFormQuery.getSpecifications());
    }
}
